<!--
 * @Description: 混入
 * @Author: zzj
 * @Date: 2021-10-13 19:18:22
 * @LastEditors: zzj
 * @LastEditTime: 2021-10-13 19:34:02
-->
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>混入</title>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
</head>
<body>
	<div id="app">
		<briup-article></briup-article>
	</div>
	<script>
			let mixin = {
				data(){  //公共属性
					return{
						msg:"hello mixin",
						foo:"this is foo"
					}
				},
				methods:{  //公共方法
					sayFoo(){
						return this.foo;
					}
				}
			}

			let briupArticle = {
				template:`
					<div>
						<div>{{msg}}</div>
						<div>{{sayFoo()}}</div>	
					</div>
				`,
				mixins:[mixin]
			}
			Vue.component('briup-article', briupArticle)


		new Vue({
			el:"#app",
		})
	</script>
</body>
</html>